#ifndef _MY_THREAD_
#define _MY_THREAD_

#include <pthread.h>
class MyThread
{
	public:
		MyThread()	{}
		virtual ~MyThread() {}

		static void* ThreadFun(void* param)
		{
			MyThread* pThread = (MyThread*)param;
			if(pThread)	pThread->run();

			return NULL;
		}

		virtual bool run() {} 

		bool start()
		{
			pthread_t thread;
			pthread_attr_t attr;
			pthread_attr_init(&attr);
			if(0 != ::pthread_create(&thread, NULL, MyThread::ThreadFun, this))
			{
				return false;
			}

			pthread_attr_destroy(&attr);
			return true;
		}
};
#endif
